#include "BBN.h"


int main(int argc, char* argv[])
{
    Screen screen(800, 600);
    if(screen.failed())
    {
        print_line("Failed to initialize.");
        return 1;
    }
    
    
    Font font1("data/FreeSans.ttf", 20);
    if(font1.failed())
    {
        print_line("Failed to load font.");
        return 1;
    }
    
    float x = 400;
    float y = 300;
    
    float t1, t2, t3;
    
    Input input;
    bool done = false;
    while(!done)
    {
        while(input.next_event())
        {
            if(input.is_quit() || input.key_pressed(SDL_SCANCODE_ESCAPE))
                done = true;
        }
        
        if(input.key_held(SDL_SCANCODE_UP))
            y -= 1;
        else if(input.key_held(SDL_SCANCODE_DOWN))
            y += 1;
        if(input.key_held(SDL_SCANCODE_LEFT))
            x -= 1;
        else if(input.key_held(SDL_SCANCODE_RIGHT))
            x += 1;
        
        t1 = 0.5f+0.5f*sin(get_total_time()*5.0f);
        t2 = 0.5f+0.5f*sin(get_total_time()*6.5f);
        t3 = 0.5f+0.5f*sin(get_total_time()*8.0f);
        
        screen.clear();
        screen.draw(font1, "Hello World!", x, y, Color(255*t1, 255*t2, 255*t3));
        
        screen.show();
        
        wait(0.01f);
    }
    
	return 0;
}

